---
version: "2"
services:
  peer:
    image: docker.repo:5000/fabric-peer:{{ app_name }}{{ image_version }}
    restart: unless-stopped
    network_mode: host
    environment:
      - CORE_PEER_ID={{ peer_id }}
      - CORE_PBFT_GENERAL_N={{ groups['peer']|length +1 }}
      - CORE_LOGGING_LEVEL=debug
      - CORE_PEER_ADDRESSAUTODETECT=true
      - CORE_PEER_NETWORKID=dev 
      - CORE_PEER_DISCOVERY_ROOTNODE={{ root_node }}:7051
      - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft
      - CORE_PBFT_GENERAL_MODE=batch
      - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
      - CORE_SECURITY_ENABLED={{ peer_enable_security }}
      - CORE_SECURITY_ENROLLID={{ enroll_id }}
      - CORE_SECURITY_ENROLLSECRET={{ enroll_secret }}
      - CORE_PEER_PKI_ECA_PADDR={{ membersrvc_node }}:{{ membersrvc_port }}
      - CORE_PEER_PKI_TCA_PADDR={{ membersrvc_node }}:{{ membersrvc_port }}
      - CORE_PEER_PKI_TLSCA_PADDR={{ membersrvc_node }}:{{ membersrvc_port }}
#      - CORE_PEER_PKI_TLS_ENABLED=true
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./data:/var/hyperledger/production/"
    command: sh -c "sleep 5; peer node start"
